package org.merak.core.model;

@SuppressWarnings("serial")
public class SettingException extends RuntimeException {

	//~ Constructors /////////////////////////////////////////////////////////////
	//****************************************************************************
    public SettingException(String s) {
        super(s);
    }
	//****************************************************************************
    public SettingException(String s, Throwable cause) {
        super(s,cause);
    }
	//****************************************************************************
    public SettingException(Throwable cause) {
        super(cause);
    }
	//~ Methods //////////////////////////////////////////////////////////////////
	//****************************************************************************
    public final boolean hasCause() {
    	return super.getCause() != null;
    }
	//****************************************************************************
    public final Throwable getPrimaryCause() {
    	return getPrimaryCause(this);
    }
	//****************************************************************************
    public static Throwable getPrimaryCause(Throwable ex) {

    	Throwable cause = ex.getCause();
    	if (cause != null) {
        	while (cause.getCause() != null) {
        		cause = cause.getCause();
        	}
    	}
    	return cause;

    }
	//****************************************************************************

}
